package com.yeban.javase.day11.test01;

import java.util.ArrayList;
import java.util.List;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/10/20
 *
 * 按照斗地主的规则，完成**洗牌发牌**的动作。
 * 具体规则：
 * 使用54张牌打乱顺序,三个玩家参与游戏，三人交替摸牌，每人17张牌，最后三张留作底牌。
 * 牌进行排序、拿大王的可以拿底牌。
 *
 * 1.做牌  Card 花色color、数字num、索引index  --》 存储至List<Card>
 * 2.乱序  --> Collections的shuffle()
 * 3.发牌  --> 51张牌 %3  + 剩余3张牌作为底牌  --》 存储至List<Card>
 * 4.底牌  --> 拿取大王的可以拿底牌
 * 5.排序  --> 将各玩家的牌进行排序
 *
 * "♠", "♥", "♣", "♦"
 * "2", "A", "K", "Q", "J", "10", "9", "8", "7", "6", "5", "4", "3"
 */

public class PokerGame {

    public static void main(String[] args) {
        PokerCards pokerCards = new PokerCards();

        ArrayList<Card> player1 = new ArrayList<>();
        ArrayList<Card> player2 = new ArrayList<>();
        ArrayList<Card> player3 = new ArrayList<>();

        List<Card> bottonCards = pokerCards.getPokers(player1, player2, player3);    // 发牌

        int first = pokerCards.whoFirst(player1, player2, player3);
        // 展示发牌结果
        System.out.println("---------- Player1 ----------");
        System.out.println(player1);
        System.out.println("---------- Player2 ----------");
        System.out.println(player2);
        System.out.println("---------- Player3 ----------");
        System.out.println(player3);
        System.out.println("本局底牌: " + bottonCards);

        switch(first) {
            case 1:
                player1.addAll(bottonCards);
                System.out.println("本轮Player1先出牌！");
                break;
            case 2:
                player2.addAll(bottonCards);
                System.out.println("本轮Player2先出牌！");
                break;
            case 3:
                player3.addAll(bottonCards);
                System.out.println("本轮Player3先出牌！");
                break;
            default:
                System.out.println("本局轮空！重新发牌！");
        }

    }
}


